﻿using System;
using UnityEditor;
using AK.Wwise.TreeView;

namespace AudioStudio.Editor
{
    [CustomPropertyDrawer(typeof(Switch))]
    public class SwitchDrawer : AudioBaseTypeDrawer
    {   
        public override void SetupSerializedProperties(SerializedProperty property)
        {
            m_objectType = AkWwiseProjectData.WwiseObjectType.SWITCH;
            m_typeName = "Switch";            
        }

        protected override string GetText(SerializedProperty property)
        {
            SerializedProperty name = property.FindPropertyRelative("name");
            SerializedProperty groupName = property.FindPropertyRelative("groupName");
            return groupName.stringValue + "/" + name.stringValue;
        }

        protected override void OnDragAndDrop(SerializedProperty property, AkDragDropData data)
        {
            base.OnDragAndDrop(property, data);
            OnDragAndDropGroup(property, data);
        }

        protected override void OnPickerChanged(SerializedProperty property, TreeViewItem treeItem)
        {
            PickerChangeGroup(property, treeItem, AkWwiseProjectData.Instance.SwitchWwu);
        }
    }
}